package sktit.practice.jpaint.canvas;

import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;

import sktit.practice.jpaint.shape.Shape;
import sktit.practice.jpaint.util.ShapeUtils;

public class RectangleCanvas extends AbstractCanvas {

	public RectangleCanvas(GC aGC, Shape aShape) {
		super(aGC, aShape);
	}
	
	public void draw()
	{
		Point[] vertex = shape.getBorder();
		gc.drawRectangle(ShapeUtils.generate(vertex));
	}
	
	public void fill(Color color)
	{
		gc.setBackground(color);
		gc.fillRectangle(ShapeUtils.generate(shape.getBorder()));
	}
}
